package com.power.controller;

import com.power.common.Contants;
import com.power.ov.ResultData;
import com.power.utils.WriterUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * User: 朱雄
 * Date: 2020/10/04 23:55
 * Description:
 * Version: V1.0
 */
@WebServlet("/exit.do")
public class ExitController extends HttpServlet {

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        HttpSession session=req.getSession();
        session.setAttribute("user",null);
        ResultData resultData=new ResultData();
        resultData.setCode(Contants.SUCCESS);
        resultData.setMsg("成功退出");
        WriterUtil.getWriter(resp,resultData);
    }
}
